#include "Screens/LevelScreen.h"
#include "Screens/GameScreen.h"
#include "Objects/Objects.h"

LevelScreen::LevelScreen(GameState *gameState) : ScreenBase(gameState){
	
}


LevelScreen::~LevelScreen(){
	clean();
}


void LevelScreen::init(){
	ScreenBase::init();
	
	m_gameState->camera.posX = m_gameState->camera.posY = 0;

	Background *background = new Background(m_gameState, "homeBackground.png");
	addObject(background, 9);

	UILevelItem *item = new UILevelItem(m_gameState);
	addObject(item, 0);

	m_music.openFromFile(soundsPath+"GoodLuck.ogg");
	m_music.setLoop(true);
	m_music.play();

}


void LevelScreen::update(double dt){
	ScreenBase::update(dt);

	bool actionPress = Keyboard::isKeyPressed(Keyboard::Space) || Joystick::isButtonPressed(0, 0);

	if(actionPress){
		m_gameState->setCurrentScreen(new GameScreen(m_gameState));
	}
}


void LevelScreen::draw(){
	ScreenBase::draw();
}